home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_groff.idb / usr / freeware / catman / u_man / cat1 / gpic.Z / gpic
Text File  |  2002-04-08  |  22KB  |  473 lines

  1. PIC(1)                               PIC(1)
  2.  
  3.  
  4.  
  5. NNAAMMEE
  6.        pic - compile pictures for troff    or TeX
  7.  
  8. SSYYNNOOPPSSIISS
  9.        ppiicc [ --nnvvCCSSUU ] [    _f_i_l_e_n_a_m_e ...  ]
  10.        ppiicc --tt [    --ccvvzzCCSSUU    ] [ _f_i_l_e_n_a_m_e ...  ]
  11.  
  12. DDEESSCCRRIIPPTTIIOONN
  13.        This  manual  page describes the    GNU version of ppiicc, which
  14.        is part of the groff document formatting    system.     ppiicc com
  15.        piles  descriptions  of    pictures embedded within ttrrooffff or
  16.        TeX input files into commands that are understood  by  TeX
  17.        or  ttrrooffff.  Each    picture    starts with a line beginning with
  18.        ..PPSS and ends with a line     beginning  with  ..PPEE.     Anything
  19.        outside of ..PPSS and ..PPEE is passed    through    without    change.
  20.  
  21.        It  is  the  user's  responsibility to provide appropriate
  22.        definitions of the PPSS and PPEE macros.  When the macro pack
  23.        age being used does not supply such definitions (for exam
  24.        ple, old    versions of -ms), appropriate definitions can  be
  25.        obtained    with --mmppiicc: these will center each picture.
  26.  
  27. OOPPTTIIOONNSS
  28.        Options that do not take    arguments may be grouped behind    a
  29.        single --.  The special option ----    can be used to    mark  the
  30.        end  of    the options.  A    filename of -- refers to    the stan
  31.        dard input.
  32.  
  33.        --CC     Recognize    ..PPSS and    ..PPEE even when followed by a char
  34.           acter other than space or    newline.
  35.  
  36.        --SS     Safer  mode;  do not execute sshh commands.     This can
  37.           be useful    when operating    on  untrustworthy  input.
  38.           (enabled by default)
  39.  
  40.        --UU     Unsafe mode; revert the default option --SS.
  41.  
  42.        --nn     Don't use    the groff extensions to    the troff drawing
  43.           commands.     You should use    this if    you are     using    a
  44.           postprocessor  that  doesn't  support  these exten
  45.           sions.    The   extensions   are      described    in
  46.           ggrrooffff__oouutt(5).  The --nn option also    causes ppiicc not to
  47.           use zero-length lines to draw dots in troff mode.
  48.  
  49.        --tt     TeX mode.
  50.  
  51.        --cc     Be more compatible with ttppiicc.  Implies  --tt.   Lines
  52.           beginning     with  \\ are not passed    through    transpar
  53.           ently.  Lines beginning with ..  are passed  through
  54.           with the initial ..  changed to \\.     A line    beginning
  55.           with ..ppss is given    special    treatment:  it    takes  an
  56.           optional     integer  argument  specifying    the  line
  57.           thickness    (pen  size)  in     milliinches;  a  missing
  58.           argument    restores the previous line thickness; the
  59.           default line thickness is    8 milliinches.    The  line
  60.           thickness     thus  specified takes effect only when    a
  61.           non-negative line    thickness has not been    specified
  62.           by use of    the tthhiicckknneessss attribute    or by setting the
  63.           lliinneetthhiicckk    variable.
  64.  
  65.        --vv     Print the    version    number.
  66.  
  67.        --zz     In TeX mode draw dots using zero-length lines.
  68.  
  69.        The following options supported by other    versions  of  ppiicc
  70.        are ignored:
  71.  
  72.        --DD     Draw  all     lines using the \D escape sequence.  ppiicc
  73.           always does this.
  74.  
  75.        --TT _d_e_v Generate output for the ttrrooffff device _d_e_v.     This  is
  76.           unnecessary  because  the    ttrrooffff output generated by
  77.           ppiicc is device-independent.
  78.  
  79. UUSSAAGGEE
  80.        This section describes only the    differences  between  GNU
  81.        ppiicc  and     the original version of ppiicc.  Many of these dif
  82.        ferences    also apply to newer versions of    Unix ppiicc.
  83.  
  84.    TTeeXX mmooddee
  85.        TeX mode    is enabled by the --tt option.  In  TeX  mode,  ppiicc
  86.        will  define  a    vbox called \\ggrraapphh for each picture.  You
  87.        must yourself print that    vbox using, for    example, the com
  88.        mand
  89.  
  90.           \\cceenntteerrlliinnee{{\\bbooxx\\ggrraapphh}}
  91.  
  92.        Actually,  since     the  vbox has a height    of zero    this will
  93.        produce slightly    more vertical  space  above  the  picture
  94.        than below it;
  95.  
  96.           \\cceenntteerrlliinnee{{\\rraaiissee 11eemm\\bbooxx\\ggrraapphh}}
  97.  
  98.        would avoid this.
  99.  
  100.        You must    use a TeX driver that supports the ttppiicc    specials,
  101.        version 2.
  102.  
  103.        Lines beginning with \\ are passed through transparently;    a
  104.        %%  is  added  to     the  end  of  the line    to avoid unwanted
  105.        spaces.    You can    safely use this    feature    to  change  fonts
  106.        or  to  change  the value of \\bbaasseelliinneesskkiipp.  Anything else
  107.        may well    produce    undesirable  results;  use  at    your  own
  108.        risk.   Lines  beginning     with  a period    are not    given any
  109.        special treatment.
  110.  
  111.    CCoommmmaannddss
  112.        ffoorr _v_a_r_i_a_b_l_e == _e_x_p_r_1 ttoo _e_x_p_r_2 [bbyy [**]_e_x_p_r_3] ddoo _X    _b_o_d_y _X
  113.           Set _v_a_r_i_a_b_l_e to _e_x_p_r_1.  While the    value of _v_a_r_i_a_b_l_e
  114.           is  less than or equal to    _e_x_p_r_2, do _b_o_d_y and incre
  115.           ment _v_a_r_i_a_b_l_e by _e_x_p_r_3; if bbyy is not given,  incre
  116.           ment _v_a_r_i_a_b_l_e by 1.  If _e_x_p_r_3 is prefixed    by ** then
  117.           _v_a_r_i_a_b_l_e will instead be multiplied  by  _e_x_p_r_3.    _X
  118.           can be any character not occurring in _b_o_d_y.
  119.  
  120.        iiff _e_x_p_r tthheenn _X _i_f_-_t_r_u_e _X    [eellssee _Y    _i_f_-_f_a_l_s_e _Y]
  121.           Evaluate    _e_x_p_r;  if it is    non-zero then do _i_f_-_t_r_u_e,
  122.           otherwise    do _i_f_-_f_a_l_s_e.  _X    can be any character  not
  123.           occurring     in  _i_f_-_t_r_u_e.  _Y can be    any character not
  124.           occurring    in _i_f_-_f_a_l_s_e.
  125.  
  126.        pprriinntt _a_r_g...
  127.           Concatenate the arguments    and print as  a     line  on
  128.           stderr.    Each  _a_r_g  must    be an expression, a posi
  129.           tion, or text.  This is useful for debugging.
  130.  
  131.        ccoommmmaanndd _a_r_g...
  132.           Concatenate the arguments    and pass them through  as
  133.           a    line to    troff orTeX.  Each _a_r_g must be an expres
  134.           sion, a position,    or  text.   This  has  a  similar
  135.           effect to    a line beginning with ..     or \\, but allows
  136.           the values of variables to be passed through.
  137.  
  138.        sshh _X _c_o_m_m_a_n_d _X
  139.           Pass _c_o_m_m_a_n_d to a    shell.    _X can  be  any    character
  140.           not occurring in _c_o_m_m_a_n_d.
  141.  
  142.        ccooppyy ""_f_i_l_e_n_a_m_e""
  143.           Include _f_i_l_e_n_a_m_e at this point in    the file.
  144.  
  145.        ccooppyy [""_f_i_l_e_n_a_m_e""] tthhrruu _X    _b_o_d_y _X [uunnttiill ""_w_o_r_d""]
  146.        ccooppyy [""_f_i_l_e_n_a_m_e""] tthhrruu _m_a_c_r_o [uunnttiill ""_w_o_r_d""]
  147.           This  construct  does  _b_o_d_y  once     for each line of
  148.           _f_i_l_e_n_a_m_e;    the line is  split  into  blank-delimited
  149.           words, and occurrences of    $$_i in _b_o_d_y, for    _i between
  150.           1    and 9, are replaced by the _i-th    word of    the line.
  151.           If  _f_i_l_e_n_a_m_e is not given, lines are taken from the
  152.           current input up to ..PPEE.    If  an    uunnttiill  clause  is
  153.           specified, lines will be read only until a line the
  154.           first word of which is _w_o_r_d; that    line will then be
  155.           discarded.  _X can    be any character not occurring in
  156.           _b_o_d_y.  For example,
  157.  
  158.              ..PPSS
  159.              ccooppyy tthhrruu %% cciirrccllee    aatt (($$11,,$$22)) %% uunnttiill ""EENNDD""
  160.              11 22
  161.              33 44
  162.              55 66
  163.              EENNDD
  164.              bbooxx
  165.              ..PPEE
  166.  
  167.           is equivalent to
  168.  
  169.              ..PPSS
  170.              cciirrccllee aatt ((11,,22))
  171.              cciirrccllee aatt ((33,,44))
  172.              cciirrccllee aatt ((55,,66))
  173.              bbooxx
  174.              ..PPEE
  175.  
  176.           The commands to be performed for each line can also
  177.           be taken from a macro defined earlier by giving the
  178.           name of the macro    as the argument    to tthhrruu.
  179.  
  180.        rreesseett
  181.        rreesseett _v_a_r_i_a_b_l_e_1,,    _v_a_r_i_a_b_l_e_2 _._._.
  182.           Reset pre-defined     variables  _v_a_r_i_a_b_l_e_1,    _v_a_r_i_a_b_l_e_2
  183.           ...  to  their default values.  If no arguments are
  184.           given, reset all    pre-defined  variables    to  their
  185.           default  values.     Note  that  assigning a value to
  186.           ssccaallee also causes    all  pre-defined  variables  that
  187.           control  dimensions  to  be  reset to their default
  188.           values times the new value of scale.
  189.  
  190.        pplloott _e_x_p_r [""_t_e_x_t""]
  191.           This is a    text object which is constructed by using
  192.           _t_e_x_t  as    a format string    for sprintf with an argu
  193.           ment of _e_x_p_r.  If    _t_e_x_t is    omitted    a  format  string
  194.           of  ""%%gg""    is  used.  Attributes can be specified in
  195.           the same way as for a normal text    object.     Be  very
  196.           careful  that  you  specify  an  appropriate format
  197.           string; ppiicc does only very limited checking of  the
  198.           string.  This is deprecated in favour of sspprriinnttff.
  199.  
  200.        _v_a_r_i_a_b_l_e::==_e_x_p_r
  201.           This  is    similar    to == except _v_a_r_i_a_b_l_e must already
  202.           be defined, and  the  value  of  _v_a_r_i_a_b_l_e     will  be
  203.           changed  only in the innermost block in which it is
  204.           defined.    (By contrast, ==    defines    the  variable  in
  205.           the  current  block  if  it  is not already defined
  206.           there, and then changes the value     in  the  current
  207.           block.)
  208.  
  209.        Arguments of the    form
  210.  
  211.           _X    anything _X
  212.  
  213.        are also    allowed    to be of the form
  214.  
  215.           {{    _a_n_y_t_h_i_n_g }}
  216.  
  217.        In  this    case _a_n_y_t_h_i_n_g can contain balanced occurrences of
  218.        {{ and }}.     Strings may contain _X or imbalanced  occurrences
  219.        of {{ and    }}.
  220.  
  221.    EExxpprreessssiioonnss
  222.        The   syntax   for   expressions     has  been  significantly
  223.        extended:
  224.  
  225.        _x ^^ _y (exponentiation)
  226.        ssiinn((_x))
  227.        ccooss((_x))
  228.        aattaann22((_y,,    _x))
  229.        lloogg((_x)) (base 10)
  230.        eexxpp((_x)) (base 10,    ie 10_x)
  231.        ssqqrrtt((_x))
  232.        iinntt((_x))
  233.        rraanndd(()) (return a    random number between 0    and 1)
  234.        rraanndd((_x)) (return a random    number between 1  and  _x;  depre
  235.        cated)
  236.        ssrraanndd((_x))    (set the random    number seed)
  237.        mmaaxx((_e_1,, _e_2))
  238.        mmiinn((_e_1,, _e_2))
  239.        !!_e
  240.        _e_1 &&&& _e_2
  241.        _e_1 |||| _e_2
  242.        _e_1 ==== _e_2
  243.        _e_1 !!== _e_2
  244.        _e_1 >>== _e_2
  245.        _e_1 >> _e_2
  246.        _e_1 <<== _e_2
  247.        _e_1 << _e_2
  248.        ""_s_t_r_1"" ==== ""_s_t_r_2""
  249.        ""_s_t_r_1"" !!== ""_s_t_r_2""
  250.  
  251.        String  comparison  expressions    must  be parenthesised in
  252.        some contexts to    avoid ambiguity.
  253.  
  254.    OOtthheerr CChhaannggeess
  255.        A bare expression, _e_x_p_r,    is acceptable as an attribute; it
  256.        is equivalent to    _d_i_r _e_x_p_r, where    _d_i_r is the current direc
  257.        tion.  For example
  258.  
  259.           lliinnee 22ii
  260.  
  261.        means draw a line 2 inches long in the current  direction.
  262.  
  263.        The maximum width and height of the picture are taken from
  264.        the variables mmaaxxppsswwiidd and mmaaxxppsshhtt.  Initially these  have
  265.        values 8.5 and 11.
  266.  
  267.        Scientific notation is allowed for numbers.  For    example
  268.           xx    == 55ee--22
  269.  
  270.        Text attributes can be compounded.  For example,
  271.           ""ffoooo"" aabboovvee lljjuusstt
  272.        is legal.
  273.  
  274.        There  is  no  limit  to     the depth to which blocks can be
  275.        examined.  For example,
  276.           [[AA:: [[BB:: [[CC:: bbooxx ]]]]]] wwiitthh ..AA..BB..CC..ssww aatt 11,,22
  277.           cciirrccllee aatt    llaasstt [[]]..AA..BB..CC
  278.        is acceptable.
  279.  
  280.        Arcs now    have compass points determined by the  circle  of
  281.        which the arc is    a part.
  282.  
  283.        Circles    and  arcs  can    be dotted or dashed.  In TeX mode
  284.        splines can be dotted or    dashed.
  285.  
  286.        Boxes can have rounded corners.    The rraadd    attribute  speci
  287.        fies the    radius of the quarter-circles at each corner.  If
  288.        no rraadd or ddiiaamm attribute    is given, a radius of  bbooxxrraadd  is
  289.        used.   Initially,  bbooxxrraadd  has    a value    of 0.  A box with
  290.        rounded corners can be dotted or    dashed.
  291.  
  292.        The ..PPSS line can    have a second argument specifying a maxi
  293.        mum height for the picture.  If the width of zero is spec
  294.        ified the width will be ignored in computing  the  scaling
  295.        factor  for  the     picture.   Note that GNU ppiicc will always
  296.        scale a picture by the same amount vertically as     horizon
  297.        tally.    This  is different from    the DWB    2.0 ppiicc    which may
  298.        scale a picture by a different amount vertically    than hor
  299.        izontally if a height is    specified.
  300.  
  301.        Each  text object has an    invisible box associated with it.
  302.        The compass points of a text object are determined by this
  303.        box.   The  implicit  motion associated with the    object is
  304.        also determined by this box.  The dimensions of    this  box
  305.        are  taken  from     the  width and    height attributes; if the
  306.        width attribute is not supplied then  the  width     will  be
  307.        taken  to  be tteexxttwwiidd; if the height attribute is not sup
  308.        plied then the height will be taken to be  the  number  of
  309.        text  strings  associated  with    the  object times tteexxtthhtt.
  310.        Initially tteexxttwwiidd and tteexxtthhtt have a value of 0.
  311.  
  312.        In places where a quoted     text  string  can  be    used,  an
  313.        expression of the form
  314.  
  315.           sspprriinnttff((""_f_o_r_m_a_t"",,    _a_r_g,,...))
  316.  
  317.        can  also be used; this will produce the    arguments format
  318.        ted according to    _f_o_r_m_a_t,     which    should    be  a  string  as
  319.        described in pprriinnttff(3) appropriate for the number of argu
  320.        ments supplied, using only the ee, ff, gg or %% format charac
  321.        ters.
  322.  
  323.        The  thickness  of  the lines used to draw objects is con
  324.        trolled by the lliinneetthhiicckk    variable.  This    gives the  thick
  325.        ness  of     lines in points.  A negative value means use the
  326.        default thickness: in TeX output    mode, this  means  use    a
  327.        thickness of 8 milliinches; in TeX output mode with the --cc
  328.        option, this means use the line thickness specified by ..ppss
  329.        lines;  in  troff  output mode, this means use a    thickness
  330.        proportional to the pointsize.  A zero  value  means  draw
  331.        the thinnest possible line supported by the output device.
  332.        Initially  it  has  a  value  of     -1.   There  is  also    a
  333.        tthhiicckk[nneessss] attribute.  For example,
  334.  
  335.           cciirrccllee tthhiicckknneessss 11..55
  336.  
  337.        would  draw  a circle using a line with a thickness of 1.5
  338.        points.    The thickness of lines is  not    affected  by  the
  339.        value  of  the  ssccaallee variable, nor by the width    or height
  340.        given in    the ..PPSS    line.
  341.  
  342.        Boxes (including    boxes with rounded corners), circles  and
  343.        ellipses     can  be  filled  by  giving then an attribute of
  344.        ffiillll[eedd].  This takes an    optional argument of  an  expres
  345.        sion  with  a  value  between 0 and 1; 0    will fill it with
  346.        white, 1    with black, values in between with a  proportion
  347.        ally gray shade.     A value greater than 1    can also be used:
  348.        this means fill with the    shade of gray that  is    currently
  349.        being  used  for     text  and  lines.  Normally this will be
  350.        black, but output devices  may  provide    a  mechanism  for
  351.        changing    this.  Without an argument, then the value of the
  352.        variable    ffiillllvvaall    will be    used.  Initially this has a value
  353.        of 0.5.    The invisible attribute    does not affect    the fill
  354.        ing of objects.    Any text associated with a filled  object
  355.        will  be     added    after the object has been filled, so that
  356.        the text    will not be obscured by    the filling.
  357.  
  358.        Arrow heads will    be drawn as solid triangles if the  vari
  359.        able  aarrrroowwhheeaadd is non-zero and either TeX mode is enabled
  360.        or the --xx option    has been given.     Initially aarrrroowwhheeaadd  has
  361.        a value of 1.
  362.  
  363.        The  troff  output  of  ppiicc is device-independent.  The --TT
  364.        option is therefore redundant.  All numbers are    taken  to
  365.        be in inches; numbers are never interpreted to be in troff
  366.        machine units.
  367.  
  368.        Objects can have    an aalliiggnneedd  attribute.     This  will  only
  369.        work when the postprocessor is ggrrooppss.  Any text associated
  370.        with an    object    having    the  aalliiggnneedd  attribute     will  be
  371.        rotated    about  the  center  of    the  object so that it is
  372.        aligned in the direction    from the start point to     the  end
  373.        point  of  the object.  Note that this attribute    will have
  374.        no effect for objects whose start and end points    are coin
  375.        cident.
  376.  
  377.        In  places  where _ntthh is    allowed    ``_e_x_p_r''tthh is also allowed.
  378.        Note that ''tthh is    a  single  token:  no  space  is  allowed
  379.        between the '' and the tthh.  For example,
  380.  
  381.           ffoorr ii == 11    ttoo 44 ddoo    {{
  382.          line from `i'th box.nw    to `i+1'th box.se
  383.           }
  384.  
  385. CCOONNVVEERRSSIIOONN
  386.        To  obtain  a stand-alone picture from a    ppiicc file, enclose
  387.        your ppiicc    code with ..PPSS and ..PPEE requests;     rrooffff  configura
  388.        tion  commands  may be added at the beginning of    the file,
  389.        but no rrooffff text.
  390.  
  391.        It is necessary to  feed     this  file  into  ggrrooffff  without
  392.        adding  any  page information, so you must check    which ..PPSS
  393.        and ..PPEE requests    are actually called.  For example, the mm
  394.        macro  package adds a page number, which    is very    annoying.
  395.        At the moment, calling standard ggrrooffff  without  any  macro
  396.        package    works.     Alternatively,     you  can define your own
  397.        requests, e.g. to do nothing:
  398.  
  399.           ..ddee PPSS
  400.           ....
  401.           ..ddee PPEE
  402.           ....
  403.  
  404.        ggrrooffff itself does not provide direct conversion into other
  405.        graphics     file  formats.     But there are lots of possibili
  406.        ties if you first transform your    picture    into  PostScript
  407.        format  using  the  ggrrooffff option    --TTppss.  Since this _p_s-file
  408.        lacks BoundingBox information it    is  not     very  useful  by
  409.        itself,    but it may be fed into other conversion    programs,
  410.        usually named ppss22_o_t_h_e_r or ppssttoo_o_t_h_e_r or  the  like.   More
  411.        over,  the  PostScript  interpreter  gghhoossttssccrriipptt     (ggss) has
  412.        built-in    graphics conversion devices that are called  with
  413.        the option
  414.  
  415.           ggss --ssDDEEVVIICCEE==_<_d_e_v_n_a_m_e_>
  416.  
  417.        Call
  418.           ggss ----hheellpp
  419.  
  420.        for a list of the available devices.
  421.  
  422.        As  the Encapsulated PostScript File Format EEPPSS is getting
  423.        more  and  more    important,  and     the  conversion   wasn't
  424.        regarded     trivial  in  the past you might be interested to
  425.        know that there is a conversion tool  named  ppss22eeppss  which
  426.        does  the  right     job.    It  is    much better than the tool
  427.        ppss22eeppssii packaged    with ggss.
  428.  
  429.        For bitmapped graphic formats, you should use ppssttooppnnmm; the
  430.        resulting (intermediate)    PPNNMM file can be    then converted to
  431.        virtually any graphics  format  using  the  tools  of  the
  432.        nneettppbbmm package .
  433.  
  434. FFIILLEESS
  435.        //uussrr//ffrreeeewwaarree//sshhaarree//ggrrooffff//11..1177..22//ttmmaacc//ppiicc..ttmmaacc
  436.           Example definitions of the PPSS and    PPEE macros.
  437.  
  438. SSEEEE AALLSSOO
  439.        ttrrooffff(1),    ggrrooffff__oouutt(5),   tteexx(1),   ggss(1),   ppss22eeppss(1),
  440.        ppssttooppnnmm(1), ppss22eeppssii(1), ppnnmm(5)
  441.  
  442.        Tpic: Pic for TeX
  443.  
  444.        Brian W.    Kernighan, PIC -- A Graphics Language  for  Type
  445.        setting    (User Manual).    AT&T Bell Laboratories,    Computing
  446.        Science    Technical  Report  No. 116   <URL:http://cm.bell-
  447.        labs.com/cm/cs/cstr/116.ps.gz> (revised May, 1991).
  448.  
  449.        ppss22eeppss is available from    CTAN mirrors, e.g.
  450.        <ftp://ftp.dante.de/tex-archive/support/ps2eps/>
  451.  
  452.        W. Richard Stevens - Turning PIC    Into HTML
  453.        <http://www.kohala.com/start/troff/pic2html.html>
  454.  
  455.        W. Richard Stevens - Examples of    picMacros
  456.        <http://www.kohala.com/start/troff/pic.examples.ps>
  457.  
  458. BBUUGGSS
  459.        Input characters    that are illegal for ggrrooffff (ie those with
  460.        ASCII code 0 or between 013 and 037 octal or between  0200
  461.        and 0237    octal) are rejected even in TeX    mode.
  462.  
  463.        The interpretation of ffiillllvvaall is    incompatible with the pic
  464.        in 10th edition Unix, which interprets 0    as black and 1 as
  465.        white.
  466.  
  467.        PostScript  is  a  registered  trademark    of Adobe Systems
  468.        Incorporation.
  469.  
  470.  
  471.  
  472. Groff Version 1.17.2       27 June 2001               PIC(1)
  473.